﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WhsFacebook.Net.Contracts;
using WhsFacebook.Net.Web.Database;

public static class WhsFacebookExtensionMethods
{
    public static DbUserSystemInfo ToDatabase(this WhsSystemInfo si)
    {
        return new DbUserSystemInfo()
        {
            InstanceId = si.InstanceId,
            Locale = si.Locale,
            OsVersion = si.OsVersion,
            Submission = DateTime.UtcNow,
            SystemManufacturer = (si.SystemManufacturer == null ? null : si.SystemManufacturer.Trim()),
            SystemModel = (si.SystemModel == null ? null : si.SystemModel.Trim()),
            TimeZone = si.TimeZone,
            TotalRam = si.TotalRam,
            WhsVersion = si.WhsVersion,
            WhsDomain = si.WhsDomain,
        };
    }

    public static DbUserStorageInfo ToDatabase(this WhsStorageInfo si)
    {
        return new DbUserStorageInfo()
        {
            InstanceId = si.InstanceId,
            Submission = DateTime.UtcNow,
            AppFoldersSize = si.AppFoldersSize,
            BackupSize = si.BackupSize,
            OperatingSystemSize = si.OperatingSystemSize,
            SharedFoldersDupSize = si.SharedFoldersDupSize,
            SharedFoldersSize = si.SharedFoldersSize,
            StorageFreeSpace = si.StorageFreeSpace,
            StorageSize = si.StorageSize,
            StorageUsedSpace = si.StorageUsedSpace,
        };
    }
}
